package com.ls.pattern.observer.gper;

import com.google.common.eventbus.EventBus;

/**
 * @author 挥之以墨
 */
public class Gper {
    private String name = "Gper生态圈";
    private static final Gper gper = new Gper();

    private Question question;

    private Gper() {
    }

    public static Gper getInstance() {
        return gper;
    }

    public String getName() {
        return name;
    }

    public static Gper getGper() {
        return gper;
    }

    public Question getQuestion() {
        return question;
    }

    public void setQuestion(Question question) {
        this.question = question;
    }

    public void publishQuestion(EventBus eventBus) {
        System.out.println(question.getUserName() + "在" + this.name + "上提交了一个问题。");
        eventBus.post(this);
    }
}
